home *** CD-ROM | disk | FTP | other *** search
/ Gigantic Games 2 / Gigantic Games 2.iso / pc / _b_ / backgammon / backmenu.c < prev    next >
C/C++ Source or Header  |  1994-12-23  |  6KB  |  205 lines

  1. /********************************************************************/
  2. /*                                                                  */
  3. /*  Hoser BackGammon version 1.0                                    */
  4. /*                                                                  */
  5. /*      Robert Pfister                                              */
  6. /*                                                                  */
  7. /*      Rfd#3 Box 2340                home:(207)-873-3520           */
  8. /*      Waterville, Maine 04901                                     */
  9. /*                                                                  */
  10. /*      Pfister_rob%dneast@dec.decwrl                               */
  11. /*                                                                  */
  12. /*                                                                  */
  13. /*  Copyright  June,1987 all rights reserved.                       */
  14. /*                                                                  */
  15. /*  This program will play a game of backgammon at the novice level */
  16. /*                                                                  */
  17. /*  The code is in 4 parts...                                       */
  18. /*                                                                  */
  19. /*       1) back.c     - main driver                                */
  20. /*       2) eval.c     - evaluation of moves                        */
  21. /*   /   3) backscn.c  - screen stuff..                             */
  22. /* \/    4) backmenu.c - menu stuff, help text, and ``decoder''     */
  23. /*                                                                  */
  24. /* this was compiled under Manx 3.20a, using long integers          */
  25. /*                                                                  */
  26. /********************************************************************/
  27.  
  28. #include "functions.h"
  29. #include "exec/types.h"
  30. #include "intuition/intuition.h"
  31.  
  32.  
  33. char *Help[] =
  34.        {
  35.        "Help\0",
  36.        "To move a peice, click on it with the left mouse button,   \n",
  37.        "then click on the spike that you want to move the peice.   \n",
  38.        "                                                           \n",
  39.        "The `bar' is the center strip of the board.                \n",
  40.        "                                                           \n",
  41.        "If your move is invalid, an error message will be displayed\n",
  42.        "in the menu strip.                                         \n",
  43.        "                                                           \n",
  44.        "To `cast off' peices, double click on the peice desired    \n",
  45.        "                                                           \n",      
  46.        "If you cannot move, click on your dice.                    \n",
  47.        "                                                           \n",
  48.        "The number that appears below the menu bar is the number   \n",
  49.        "of the position that's  being evaluated.  For doubles      \n",
  50.        "this number can reach around 5000,  so be patient          \n",
  51.        "                                                           \n",
  52.        "`Redo Move' returns board to the start of the move         \n",
  53.        "`Take Back' will back up one move                          \n",
  54.  
  55.        };
  56.  
  57. int NumHelp=18;
  58.  
  59. char *credits[] =
  60.        {
  61.        "Credits \0",
  62.        "Hoser BackGammon    Copyright June 1987  Robert Pfister        \n",
  63.        "                                                               \n",
  64.        "Written in Aztec 'C' 3.20  as an A.I. course project.  Use's   \n",
  65.        "home-brewed heuristics to play like I would.                   \n",
  66.        "                                                               \n",
  67.        "Snail-Mail:                {donations accepted..I suppose}     \n",
  68.        "      Robert Pfister                                           \n",
  69.        "      Rfd#3 box 2340                                           \n",
  70.        "      Waterville, Maine 04901         phone:  207-873-3520     \n",
  71.        "                                                               \n",
  72.        "or E-Mail:   pfister_rob%dneast.dec@decwrl.dec.com             \n",
  73.        "                                                               \n",
  74.        "Freely Distributable  if I'm credited with the Original version\n"
  75.        };
  76.  
  77. int NumCredits=13;
  78.  
  79. struct IntuiText IText[]=
  80.  {
  81.   {0,1,JAM1,CHECKWIDTH,0,NULL,"New Game"},      /*  0 */
  82.   {0,1,JAM1,CHECKWIDTH,0,NULL,"Info"},          /*  1 */
  83.   {0,1,JAM1,CHECKWIDTH,0,NULL,"Quit"},          /*  2 */
  84.   {0,1,JAM1,CHECKWIDTH,0,NULL,"Help"},          /*  3 */
  85.   {0,1,JAM1,CHECKWIDTH,0,NULL,"Back up"},       /*  4 */
  86.   {0,1,JAM1,CHECKWIDTH,0,NULL,"Redo Move"}      /*  5 */
  87.   };
  88.  
  89. struct MenuItem MenuI[]=
  90. {
  91.   
  92.   /* newgame 0: */
  93.  
  94.   { &MenuI[1],
  95.     0,0,83,9,
  96.     (ITEMTEXT|ITEMENABLED|HIGHCOMP),
  97.     NULL,
  98.     (APTR) &IText[0],
  99.     NULL,NULL,NULL
  100.     },
  101.  
  102.   /* info  1: */
  103.  
  104.   { &MenuI[2],
  105.     0,9,83,9,
  106.     (ITEMTEXT|ITEMENABLED|HIGHCOMP),
  107.     NULL,
  108.     (APTR) &IText[1],
  109.     NULL,NULL,NULL
  110.     },
  111.  
  112.   /* quit  2: */
  113.  
  114.   { NULL,
  115.     0,18,83,9,
  116.     (ITEMTEXT|ITEMENABLED|HIGHCOMP),
  117.     NULL,
  118.     (APTR) &IText[2],
  119.     NULL,NULL,NULL
  120.      },
  121.  
  122.   /* help  3: */
  123.  
  124.   { &MenuI[4],
  125.     0,0,99,9,
  126.     (ITEMTEXT|ITEMENABLED|HIGHCOMP),
  127.     NULL,
  128.     (APTR) &IText[3],
  129.     NULL,NULL,NULL
  130.     },
  131.  
  132.   /* Takeback 4:  */
  133.  
  134.   { &MenuI[5],
  135.     0,9,99,9,
  136.     (ITEMTEXT|ITEMENABLED|HIGHCOMP),
  137.     NULL,
  138.     (APTR) &IText[4],
  139.     NULL,NULL,NULL
  140.      },
  141.  
  142.   /* move hint  5: */
  143.  
  144.   { NULL,
  145.     0,18,99,9,
  146.     (ITEMTEXT|ITEMENABLED|HIGHCOMP),
  147.     NULL,
  148.     (APTR) &IText[5],
  149.     NULL,NULL,NULL
  150.     }
  151.   };
  152.  
  153. struct Menu Menu[]=
  154. {
  155.   { &Menu[1],
  156.     0,0,83,0,
  157.     MENUENABLED,
  158.     "Project",
  159.     &MenuI[0] },
  160.  
  161.   { NULL,
  162.     80,0,80,0,
  163.     MENUENABLED,
  164.     "Cheating",
  165.     &MenuI[3] }
  166.   };
  167.  
  168. struct Menu *MyMenu=&Menu[0];
  169.  
  170. DoMenu(x)
  171. int x;
  172.  
  173. {
  174.  int i,temp;
  175.  
  176.  switch (x)
  177.    {
  178.  
  179.    case  31:Restart(); return(1); break; /* new game */
  180.    
  181.    case  51:return(-1); /* quit */
  182.             break;
  183.  
  184.    /* put up a window with the credits in it */
  185.    case  41:TextScreen(credits,NumCredits);
  186.             break;
  187.  
  188.    /* take back a full move */
  189.    case 141:RecallMove(-1); 
  190.             break;
  191.  
  192.    case 151:RecallMove(0);
  193.             break;            
  194.    /* do it for help as well */
  195.    case 131:TextScreen(Help,NumHelp);
  196.             break;
  197.  
  198.  
  199.    default:break;
  200.    }
  201.   
  202.  return(0); 
  203.  }
  204.  
  205.